#include <iostream>
#include <algorithm>
using namespace std;
constexpr int MAXN = 100;
int sz = 0, heap[MAXN];

// 如果它的父节点大于它, 那么父节点就会进行下移, 然后子节点就会往上提拔
void push(int x) {
    int i = sz++;
    while (i > 0) {
        int p = (i - 1) / 2;
        if (heap[p] <= x) break;
        heap[i] = heap[p];
        i = p;
    }
    heap[i] = x;
}

void pop() {
    if (sz <= 0) return;
    int x = heap[--sz], i = 0;
    while (i < sz) {
        int s1 = i * 2 + 1, s2 = i * 2 + 2;
        if (s1 < sz && heap[s1] > heap[s2]) s1 = s2;
        if (heap[s1] >= x) break;
        heap[i] = heap[s1];
        i = s1; 
    };
    heap[i] = x;
    

}